package com.xoa.controller.financialManage;

import com.xoa.model.financialManage.IncomeExpensePlanType;
import com.xoa.service.financialManage.IncomeExpensePlanTypeService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

//计划类别
@RestController
@RequestMapping("/IncomeType")
public class IncomeExpensePlanTypeController {

    @Autowired
    IncomeExpensePlanTypeService incomeExpensePlanTypeService;

    //计划类别列表查询
    @RequestMapping("/findIncomType")
    public ToJson findIncom(HttpServletRequest request,IncomeExpensePlanType incomeExpensePlanType){
        return incomeExpensePlanTypeService.fundIncome(request,incomeExpensePlanType);
    }

    //计划类别根据Id查询
    @RequestMapping("/findIncomTypeById")
    public ToJson findIncomTypeById(HttpServletRequest request,IncomeExpensePlanType incomeExpensePlanType){
        return incomeExpensePlanTypeService.findIncomTypeById(request,incomeExpensePlanType);
    }

    //计划类别新增和修改
    @RequestMapping("/saveIncomType")
    public ToJson saveIncomType(HttpServletRequest request,IncomeExpensePlanType incomeExpensePlanType){
        return incomeExpensePlanTypeService.saveIncomType(request,incomeExpensePlanType);
    }

    //删除计划类别
    @RequestMapping("/deleteIncomType")
    public ToJson deleteIncomType(HttpServletRequest request,IncomeExpensePlanType incomeExpensePlanType){
        return incomeExpensePlanTypeService.deleteIncomType(request,incomeExpensePlanType);
    }
    //收支统计
    @RequestMapping("/IncomCount")
        public ToJson IncomCount(HttpServletRequest request,String year,String month,String quarter,String planId){
        return incomeExpensePlanTypeService.IncomCount(request,year,month,quarter,planId);
    }
    //年收支统计
    @RequestMapping("/incomYearCount")
    public ToJson incomYearCount(HttpServletRequest request){
        return incomeExpensePlanTypeService.incomYearCount(request);
    }

}
